package com.hxz.pojo;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author 86199
 * @Date 2021/6/23 16:26
 */
@Component
public class MyFactoryBeanBean implements FactoryBean {
    private String message;
    public MyFactoryBeanBean() {
        this.message = "通过构造方法初始化实例";
    }
    @Override
    public Object getObject() throws Exception {
//        MyFactoryBeanBean myBean = new MyFactoryBeanBean();
//        myBean.message = "通过FactoryBean.getObject()创建实例";
//        // 这里并不一定要返回MyBean自身的实例，可以是其他任何对象的实例
//        System.out.println("getObject被触发");
        return new Student();
    }
    @Override
    public Class<?> getObjectType() {
        return MyFactoryBeanBean.class;
    }
    public String getMessage() {
        return message;
    }

}